package com.dongjiantong.app.controller.biz;

import com.alibaba.dubbo.config.annotation.Reference;
import com.dongjiantong.biz.service.DjtFarmsStockFormsService;
import com.dongjiantong.common.model.Response;
import com.dongjiantong.openplatform.annotations.OpenBean;
import com.dongjiantong.openplatform.annotations.OpenMethod;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMethod;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by ldf on 2017/11/20.
 */

@Slf4j
@OpenBean
public class DjtFarmsStockFormsController {

    @Reference(version = "1.0.0")
    private DjtFarmsStockFormsService djtFarmsStockFormsService;

    /**
     *  根据 区域查询存栏变化
     *
     * @param type  养殖类型
     * @param area  区域码
     * @param limit 最近几天
     * @return
     */
    @OpenMethod(
            key = "app.DjtFarmsStockForms.findByTypeAndArea",
            paramNames = {"type","area","limit"},
            httpMethods = RequestMethod.POST)
    public Response<List<Map>> findByTypeAndArea(Integer type, String area, Integer limit) {
        Map map = new HashMap();
        map.put("animal_type", type);
        map.put("area_code", area);
        map.put("limit", limit);
        List<Map> mapList = djtFarmsStockFormsService.findByTypeAndArea(map);

        return Response.ok(mapList);
    }


}
